#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:6031)


//https://leetcode.cn/problems/container-with-most-water/
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int vmax = 0;
        while (left < right)
        {
            int v = min(height[left], height[right]) * (right - left);
            vmax = max(vmax, v);
            if (height[left] > height[right])
            {
                right--;
            }
            else
            {
                left++;
            }
        }
        return vmax;
    }
};